/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package obj;

import org.json.me.JSONException;
import org.json.me.JSONObject;

/**
 *
 * @author kUN
 */
public class ObjDiem {
    private int PK_iDiemID;
    private float fDiemchuyencan;
    private float fDiemdieukien;
    private float fDiemthi;
    private int iLanthu;
    private int iKyhoc;
    private String sMon;
    
    public ObjDiem(){};
    //set
    public ObjDiem(int iDiemID, float fDiemCC, float fDiemdk, float fDiemT, int iLan, int Ky, String Mon)
    {
        PK_iDiemID=iDiemID;
        fDiemchuyencan=fDiemCC;
        fDiemdieukien=fDiemdk;
        fDiemthi=fDiemT;
        iLanthu=iLan;
        iKyhoc=Ky;
        sMon=Mon;        
        
    }
    
    public void setPK_iDiemID(int iDiemID)
    {
        PK_iDiemID=iDiemID;           
    }
    public void setfDiemchuyencan(float iDiem)
    {
        fDiemchuyencan=iDiem;           
    }
    public void setfDiemdieukien(float iDiem)
    {
        fDiemdieukien=iDiem;           
    }
    public void setfDiemthi(float iDiem)
    {
        fDiemthi=iDiem;           
    }
    public void setiLanthu(int iDiem)
    {
        iLanthu=iDiem;           
    }
    public void setiKyhoc(int iDiem)
    {
        iKyhoc=iDiem;         
    }
    public void setsMon(String iDiem)
    {
        sMon=iDiem;           
    }
    
    //get
    
    public int getPK_iDiemID()
    {
        return PK_iDiemID;
    }
     public float getfDiemchuyencan()
    {
        return fDiemchuyencan;
    }
    
    public float getfDiemdieukien()
    {
        return fDiemdieukien;
    }
      public float getfDiemthi()
    {
        return fDiemthi;
    }
    public int getiLanthu()
    {
        return iLanthu;
    }
    public int getiKyhoc()
    {
        return iKyhoc;
    }
    public String getsMon()
    {
        return sMon;
    }
        
     public void fromJSON(String jsonString) {
		try {
			JSONObject json = new JSONObject(jsonString);
                        setPK_iDiemID(Integer.parseInt(json.getString("PK_iDiemID")));
                        setfDiemchuyencan(Float.parseFloat(json.getString("fDiemchuyencan")));
                        setfDiemdieukien(Float.parseFloat(json.getString("fDiemdieukien")));
                        setfDiemthi(Float.parseFloat(json.getString("fDiemthi")));
                        setiLanthu(Integer.parseInt(json.getString("iLanthu")));
                        setiKyhoc(Integer.parseInt(json.getString("iKyhoc")));
                        setsMon( json.getString("sMon").toString());
                        
		} catch (JSONException ex) {
			ex.printStackTrace();
		}
	}
     
     
}
